package lab02.test23;

import java.io.IOException;
import java.time.Month;
import java.util.Calendar;
import java.util.Scanner;

public class Test23 {
    public static void main(String[] args) throws IOException {

        Scanner sc=new Scanner(System.in);

        System.out.println("请输入您的生日：（几月几日）");
        int month=sc.nextInt() - 1;
        int day=sc.nextInt();

        Calendar birthday =Calendar.getInstance();
        birthday.set(Calendar.MONTH,month);
        birthday.set(Calendar.DATE,day);

        int weekday=birthday.get(Calendar.DAY_OF_WEEK);
        switch (weekday){
            case 1:
                System.out.println("您的生日是星期天");
                break;
                case 2:
                System.out.println("您的生日是星期一");
                break;
                case 3:
                System.out.println("您的生日是星期二");
                break;
                case 4:
                System.out.println("您的生日是星期三");
                break;
                case 5:
                System.out.println("您的生日是星期四");
                break;
                case 6:
                System.out.println("您的生日是星期五");
                break;
                case 7:
                System.out.println("您的生日是星期六");
                break;
        }
        Calendar calendar = Calendar.getInstance();
        calendar.getTime();

            long time = (birthday.getTimeInMillis() - calendar.getTimeInMillis()) / 60 / 60 / 24 / 1000;
            if (time>=0) {
                System.out.println("距离您的生日还有" + time + "天");
            }else {
                System.out.println("您的生日今年已经过了");
            }
    }
}
